#include <cstring>
#include <cstdio>
#include <cassert>
#include<unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "command.hpp"

int main()
{
  int wfd = open(fifoName.c_str(), O_WRONLY);
  if(wfd == -1)
  {
    cout << "error: open fail! errno:" << errno << " : " << strerror(errno) << endl;
    return 2;
  }

  char buff[NUM];
  while(true)
  {
    cout << "输入你的消息# ";
    char* msg = fgets(buff, sizeof buff, stdin);
    assert(msg);
    (void*)msg;

    ssize_t n = write(wfd, buff, sizeof buff);
    assert(n != -1);
    (void)n;
  }

  return 0;
}